Skip to content

[Refactor]: Stagehand MCP becoming the Browserbase MCP #89

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 41 commits into
base: main
Choose a base branch
from

Conversation

Kylejeong2
Copy link
Collaborator

@Kylejeong2 Kylejeong2 commented Jun 22, 2025

What

Switching the Browserbase MCP to be purely stagehand based.

To be hosted at mcp.browserbase.com/mcp and by smitihery.

Stagehand Primitives as tool calls + new tools to run stagehand sessions in parallel.

@Kylejeong2 Kylejeong2 requested a review from Copilot July 3, 2025 06:14
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR refactors the MCP server by removing the old Stagehand-only implementation and introducing a unified Browserbase MCP powered by Stagehand.

  • Fully deletes the stagehand directory (old MCP implementation).
  • Adds a new TypeScript-based src/ directory with updated tool definitions, server setup, and CLI.
  • Updates branding to “Browserbase MCP” across resources, prompts, and documentation.

Reviewed Changes

Copilot reviewed 66 out of 77 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
stagehand/src/tools.ts Removed old Stagehand tool definitions.
stagehand/src/server.ts Removed legacy Stagehand MCP server logic.
src/utils.ts Updated sanitizeMessage signature and added sanitizeForFilePath.
src/tools/index.ts Newly exports Browserbase Stagehand tools and multi-session tools.
src/index.ts Main MCP server entrypoint using Browserbase and Stagehand.
src/program.ts CLI program to start the new MCP server via Stdio or HTTP transports.
Files not reviewed (2)
  • browserbase/package-lock.json: Language not supported
  • stagehand/package-lock.json: Language not supported

greptile-apps[bot]

This comment was marked as resolved.

greptile-apps[bot]

This comment was marked as resolved.

@Kylejeong2 Kylejeong2 marked this pull request as ready for review July 3, 2025 20:41
@smithery-ai smithery-ai bot had a problem deploying to production July 6, 2025 06:55 Failure
@smithery-ai smithery-ai bot had a problem deploying to production July 7, 2025 03:33 Failure
@smithery-ai smithery-ai bot had a problem deploying to production July 7, 2025 03:36 Failure
greptile-apps[bot]

This comment was marked as resolved.

@smithery-ai smithery-ai bot had a problem deploying to production July 13, 2025 19:56 Failure
@smithery-ai smithery-ai bot had a problem deploying to production July 13, 2025 19:59 Failure
@smithery-ai smithery-ai bot had a problem deploying to production July 13, 2025 20:02 Failure
"env": {
"BROWSERBASE_API_KEY": "",
"BROWSERBASE_PROJECT_ID": ""
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

on local, will they need an LLM api key?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

on local yes you do need (also with any STDIO server thats not the remote hosted url)

package.json Outdated
"dependencies": {
"@browserbasehq/stagehand": "^2.4.0",
"@modelcontextprotocol/sdk": "^1.13.1",
"@playwright/test": "^1.49.0",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this still needed?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

or should it be core

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh yeah we don't need playwright test, can remove.

we're almost fully off of playwright core, just the cookie injection stuff that factory ai wanted

}

throw new Error(`Invalid prompt name: ${name}`);
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should add some for stagehand, probably good to get some from here:
https://github.com/browserbase/stagehand/blob/main/.cursorrules

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

adding

'key in the action template. For example: {"action": "Fill in the password", "variables": {"password": "123456"}}',
),
});

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

making a note for the future here, but we should clean up an reuse the zod schemas in https://github.com/browserbase/stagehand/blob/main/lib/inference.ts to avoid maintaining on both sides

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what do you mean? like import schemas from stagehand?

also theres no schema for act in that file

@smithery-ai smithery-ai bot had a problem deploying to production July 15, 2025 07:57 Failure
@smithery-ai smithery-ai bot had a problem deploying to production July 15, 2025 08:13 Failure
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants